package com.data.basic.chapter12;

import com.data.basic.chapter07.MySet;

/**
 * 基于AVLTree的Set
 *
 * @author wang on 2018/7/5.
 */
public class AVLSet<V extends Comparable<V>> implements MySet<V> {
    private AVLTree<V,Object> avl;

    public AVLSet() {
        this.avl = new AVLTree<>();
    }

    @Override
    public void add(V v) {
        avl.add(v,null);

    }

    @Override
    public void remove(V v) {
        avl.remove(v);

    }

    @Override
    public boolean contains(V v) {
        return avl.contains(v);
    }

    @Override
    public int getSize() {
        return avl.getSize();
    }

    @Override
    public boolean isEmpty() {
        return avl.isEmpty();
    }
}
